package com.chen.common.exception;

/**
 * @author ex_chenzy59
 * @since 2025/2/26
 */
public enum CodeThrow implements Code {
    /*兜底异常*/
    Fail(-1,"失败"),
    /*代码错误,过程产物,尽量避免出现一个消灭一个*/
    Exception_Json(-900,"json异常"),
    Exception_ObjectPool(-901,"对象池异常"),
    /*第三方组件异常*/
    DBException(-910, "数据库异常"),
    /*需给用户的异常*/
    Login_Fail(-600, "登录失败"),
    Login_Bad_Credentials(-601, "用户名或者密码输入错误,请重新登录"),
    Login_Account_Expired(-602,"账户过期,请重新登录"),
    Login_Credentials_Expired(-603,"密码过期,请重新登录"),
    Login_Disabled(-604,"账户被禁用,请重新登录"),
    Login_Locked(-605,"账户被锁定,请重新登录"),

    ;

    public final int code;
    public final String msg;

    CodeThrow(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int code() {
        return code;
    }
    @Override
    public String msg() {
        return msg;
    }
}
